# 频度计数
vowels = ['a','e','i','o','u']
word = input('请输入一串英文字符：')
found = {}
found['a'] = 0
found['e'] = 0
found['i'] = 0
found['o'] = 0
found['u'] = 0
for i in word:
    if i in vowels:
        found[i] += 1
for k,v in sorted(found.items()):
    print(k,'was found',v,'time(s).')

# 引用setdefault
vowels = ['a','e','i','o','u']
word = input('请输入一串英文字符：')
found = {}
for i in word:
    if i in vowels:
        #去除字典初始化代码后，setdefault修复了运行错误
        found.setdefault(i,0)
        found[i] += 1
for k,v in sorted(found.items()):
    print(k,'was found',v,'time(s).')

# 不再用列表改用集合
vowels = {'a','e','i','o','u'}
word = input('请输入想要查询元音的英文：')
#一行代码即可找出用了哪些元音，没有频数
i = vowels.intersection(set(word))
for b in i:
    print(b)
